﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Heavy_Metals
{
    public partial class LYXX_DMJC : Form
    {
        public LYXX_DMJC()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.dataGridView1.Rows.Clear();
            this.dataGridView1.Rows.Add("断面1", "哈尔滨市", "砷", "2012.2.4", "5.4", "分析", "查看与修改", "删除");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.textBox1.Text = "";
            this.textBox2.Text = "";
        }

        private void LYXX_DMJC_Load(object sender, EventArgs e)
        {
            DataGridViewLinkColumn lc = new DataGridViewLinkColumn();
            lc.HeaderText = "删除";
            lc.Name = "删除";
            lc.Width = 60;
            DataGridViewLinkColumn lc1 = new DataGridViewLinkColumn();
            lc1.HeaderText = "查看与修改";
            lc1.Name = "查看与修改";
            lc1.Width = 60;
            DataGridViewLinkColumn lc2 = new DataGridViewLinkColumn();
            lc2.HeaderText = "监测断面信息分析";
            lc2.Name = "监测断面信息分析";
            lc2.Width = 60;
            this.dataGridView1.Columns.Add("断面名称", "断面名称");
            this.dataGridView1.Columns.Add("所在行政区", "所在行政区");
            this.dataGridView1.Columns.Add("污染指标", "污染指标");
            this.dataGridView1.Columns.Add("监测时间", "监测时间");
            this.dataGridView1.Columns.Add("监测浓度", "监测浓度");
            this.dataGridView1.Columns.Add(lc2);
            this.dataGridView1.Columns.Add(lc1);
            this.dataGridView1.Columns.Add(lc);
            this.dataGridView1.Rows.Add("断面1", "哈尔滨市", "砷", "2012.2.4", "5.4", "分析", "查看与修改", "删除");
            this.dataGridView1.Rows.Add("11", "22", "33", "44", "55", "分析", "查看与修改", "删除");
            this.dataGridView1.Rows.Add("111", "222", "333", "444", "555", "分析", "查看与修改", "删除");
        }

        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex != -1)
            {
                if (this.dataGridView1.Columns[e.ColumnIndex].Name == "监测断面信息分析")
                {
                    LYXX_DMJC_FX ckxg = new LYXX_DMJC_FX();
                    ckxg.Show();
                }
                if (this.dataGridView1.Columns[e.ColumnIndex].Name == "删除")
                {
                    this.dataGridView1.Rows.RemoveAt(e.RowIndex);
                }
                if (this.dataGridView1.Columns[e.ColumnIndex].Name == "查看与修改")
                {
                    LYXX_DMJC_CKXG ckxg = new LYXX_DMJC_CKXG();
                    ckxg.Show();
                }
            }
        }
    }
}
